obligations(C, A, List) :- findall(O, norm(C, _, antecedent(A, _, _), consequent(O,_, _, _)), List).

obligatedAction(C, Ant, A, L, D, T) :- norm(C, _, Ant, consequent(A, L, D, T)).

satisfied(A) :- antecedent(A, _, fulfilled).

status(A, L, _, Time, fulfilled) :- satisfied(A). 
status(A, L, _, Time, pending) :- \+satisfied(A), Time < L.
status(A, L, D, Time, violated) :- \+satisfied(A), Time > D.
status(A, L, D, Time, liveline_violated) :- \+satisfied(A), L =< Time, Time < D.

connected(C, A1, A2) :- norm(C, _, antecedent(A1,_, _), consequent(A2, _, _, _)).
connected(C, A1, A2) :- norm(C, _, antecedent(A1, _, _), consequent(A3, _, _, _)), connected(C, A3, A2).

canPerform(C, Agent, Action) :- norm(C, _, antecedent(action(Action, Agent, _, _), _, fact), consequent(_, _, _, _)).
